
We need to be sure when a move has been completed:  

This is made complex by false triggering as a piece is moved, for example if one slides the piece along the board and in the process triggers other switches, or if the player picks up the pieces and then moves them back in haste.  We need either a carefully timed process or we need a button to confirm when a move has been completed.  Since this button alternative is not ideal since you'd have to press it every move, we should probably have the board wait 500ms without a change to the board, after a move, before reading the new (finalized) output; this timing could be customizable in our program which interfaces between the BS2 and the communications to the other person.  Hence, from start to completion we should allow something like one second total unless the piece being moved has not been replaced or placed somewhere new on the board.  We could even give them unlimited time to complete the move, but the board will know a move has been completed once the piece has been put back and a new piece moved, or the piece has been moved to a new location.  

Piece capturing:

Here we know both the fact that the person has removed the other players piece, and the movement of the piece which was used to take the other piece.  The user needs to be instructed at least once that they must put the taken piece in one of the valid positions for these pieces.  Since the game is one sided in this instance, a player never takes their own pieces, and as such the game need not know where to put the other person's pieces but rather only their own, which it will do on each side as we program it to do.

Piece conversion:

Here we know from the pieces that sit in the dead zone which piece was replaced with which and we can determine both that it was a pawn given the history of the game or the prior state of the game, and from the absence of a piece in the dead zone.  This also depends on player honesty.

Castling:

The board should be able to tell this from the prior history (if it is a valid move) one move ago, and the dual motions of the movement of the castle (absence of castle at end of board and new piece location at the appropriate position where it will be aside the king, and absence of the king from its prior position (its home position) and new location at the side of the castle).  To avoid cheating by replacing a bishop in the place of the castle where it would be in a castling for example, and then moving the king to its castling position and the castle to the old position of the bishop, we must have a way to detect if a person has made an intermediate move.  Hence the board will know that the bishop had been moved during the castling move.  This fits under the more general case of not having two valid moves at once (the castling is both the exception and the rule here), which the board will never be able to reset, but for which we can identify that there was a wrongful 'move' but not what it was.  So the person will have to take back such moves themselves, and we will be able to identify would be cheaters easily.

Wrong initial setup:

Presuming they know the rules of moving but not the correct initial layout, which is common, we can pick up on this at some stage in the game, and the game will simply have to be re-started.  The game cannot know the error the player has made, but it can know the original layout as it should be, so we should have the user replace the pieces in the dead zone with labels at these locations so that the board can self layout from this initial configuration.

Wrong moves:

The game needs to store the previous configuration and know the rudimentary rules of the game, as we have discussed, this should be easily programmable.  It can itself move the piece back into place, unless they move two pieces at once, in which case we don't know which piece moved where, and the game is un-recoverable and must be reset.  We also need the board to know that a person has or has not moved a piece through another piece, with the exception of the knight.



We also need ideally:

a switch for move take back.  board should be capable of moving the pieces back from the existing configuration to the previous at least one turn.  So, we need store at least the previous state and the current one.  This is also needed for valid move checking.  Valid move checking should be easily customizable.

a switch for board reset. (start a new game with layout reset given the current configuration)  This must include essentially one case, that of pieces which will be half on the board and half in the dead zone.  So the board must keep track of where the pieces are as it does, but also be able to move them all back into position.

a switch for game resume. (resume the game given the current configuration) for this the current game layout must be stored in the eeprom of the bs2 over a power down and up cycle.

a switch for on/off.  This should allow the system to shut itself off or power down, which includes storing the game layout as it is, which we do have enough memory on the BS2 for. We don't have enough memory on the BS2 to store the history of the game, therefore we should store this information on the computer or server, when/if we have a server.

an alarm for being in check?  this could serve a multiple purposes: for a wrong move (one click), a move which places you in check (two clicks), and for being in check (three clicks)  we can decide what works best or conveys this information most efficiently.  
alternatively this could be replaced with a light.

a switch for board calibrate?


i/o Usage:

So far we have consumed 6 i/o for the sensors, and then 2 each for two stepper motors.  1 for the electromagnet (if we use this).

This leaves 16-11 = 5 i/o; which is enough for the four switches above and the alarm.



Potential cases covered:

	Castling.

	Wrong moves:
		Doing the wrong thing with the piece you have selected to move:  
			!this would even help a person learn to play chess!
		Moves which place you in check.
		Cheating by switching around other pieces on the board.

	Wrong initial setup.


I can still think of one way to cheat, which is to replace a piece by sliding a magnet underneath, but with our tolerances this would be very difficult, kinda like Indiana Jones difficult.